# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Reseller.V1.Model.Subscription do
  @moduledoc """
  JSON template for a subscription.

  ## Attributes

  *   `billingMethod` (*type:* `String.t`, *default:* `nil`) - Read-only field that returns the current billing method for a subscription.
  *   `creationTime` (*type:* `String.t`, *default:* `nil`) - The `creationTime` property is the date when subscription was created. It is in milliseconds using the Epoch format. See an example Epoch converter.
  *   `customerDomain` (*type:* `String.t`, *default:* `nil`) - Primary domain name of the customer
  *   `customerId` (*type:* `String.t`, *default:* `nil`) - This property will always be returned in a response as the unique identifier generated by Google. In a request, this property can be either the primary domain or the unique identifier generated by Google.
  *   `dealCode` (*type:* `String.t`, *default:* `nil`) - Google-issued code (100 char max) for discounted pricing on subscription plans. Deal code must be included in `insert` requests in order to receive discounted rate. This property is optional, regular pricing applies if left empty.
  *   `kind` (*type:* `String.t`, *default:* `reseller#subscription`) - Identifies the resource as a Subscription. Value: `reseller#subscription`
  *   `plan` (*type:* `GoogleApi.Reseller.V1.Model.SubscriptionPlan.t`, *default:* `nil`) - The `plan` property is required. In this version of the API, the G Suite plans are the flexible plan, annual commitment plan, and the 30-day free trial plan. For more information about the API"s payment plans, see the API concepts.
  *   `purchaseOrderId` (*type:* `String.t`, *default:* `nil`) - This is an optional property. This purchase order (PO) information is for resellers to use for their company tracking usage. If a `purchaseOrderId` value is given it appears in the API responses and shows up in the invoice. The property accepts up to 80 plain text characters.
  *   `renewalSettings` (*type:* `GoogleApi.Reseller.V1.Model.RenewalSettings.t`, *default:* `nil`) - Renewal settings for the annual commitment plan. For more detailed information, see renewal options in the administrator help center.
  *   `resourceUiUrl` (*type:* `String.t`, *default:* `nil`) - URL to customer's Subscriptions page in the Admin console. The read-only URL is generated by the API service. This is used if your client application requires the customer to complete a task using the Subscriptions page in the Admin console.
  *   `seats` (*type:* `GoogleApi.Reseller.V1.Model.Seats.t`, *default:* `nil`) - This is a required property. The number and limit of user seat licenses in the plan.
  *   `skuId` (*type:* `String.t`, *default:* `nil`) - A required property. The `skuId` is a unique system identifier for a product's SKU assigned to a customer in the subscription. For products and SKUs available in this version of the API, see Product and SKU IDs.
  *   `skuName` (*type:* `String.t`, *default:* `nil`) - Read-only external display name for a product's SKU assigned to a customer in the subscription. SKU names are subject to change at Google's discretion. For products and SKUs available in this version of the API, see Product and SKU IDs.
  *   `status` (*type:* `String.t`, *default:* `nil`) - This is an optional property.
  *   `subscriptionId` (*type:* `String.t`, *default:* `nil`) - The `subscriptionId` is the subscription identifier and is unique for each customer. This is a required property. Since a `subscriptionId` changes when a subscription is updated, we recommend not using this ID as a key for persistent data. Use the `subscriptionId` as described in retrieve all reseller subscriptions.
  *   `suspensionReasons` (*type:* `list(String.t)`, *default:* `nil`) - Read-only field containing an enumerable of all the current suspension reasons for a subscription. It is possible for a subscription to have many concurrent, overlapping suspension reasons. A subscription's `STATUS` is `SUSPENDED` until all pending suspensions are removed. Possible options include: - `PENDING_TOS_ACCEPTANCE` - The customer has not logged in and accepted the G Suite Resold Terms of Services. - `RENEWAL_WITH_TYPE_CANCEL` - The customer's commitment ended and their service was cancelled at the end of their term. - `RESELLER_INITIATED` - A manual suspension invoked by a Reseller. - `TRIAL_ENDED` - The customer's trial expired without a plan selected. - `OTHER` - The customer is suspended for an internal Google reason (e.g. abuse or otherwise). 
  *   `transferInfo` (*type:* `GoogleApi.Reseller.V1.Model.SubscriptionTransferInfo.t`, *default:* `nil`) - Read-only transfer related information for the subscription. For more information, see retrieve transferable subscriptions for a customer.
  *   `trialSettings` (*type:* `GoogleApi.Reseller.V1.Model.SubscriptionTrialSettings.t`, *default:* `nil`) - The G Suite annual commitment and flexible payment plans can be in a 30-day free trial. For more information, see the API concepts.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :billingMethod => String.t() | nil,
          :creationTime => String.t() | nil,
          :customerDomain => String.t() | nil,
          :customerId => String.t() | nil,
          :dealCode => String.t() | nil,
          :kind => String.t() | nil,
          :plan => GoogleApi.Reseller.V1.Model.SubscriptionPlan.t() | nil,
          :purchaseOrderId => String.t() | nil,
          :renewalSettings => GoogleApi.Reseller.V1.Model.RenewalSettings.t() | nil,
          :resourceUiUrl => String.t() | nil,
          :seats => GoogleApi.Reseller.V1.Model.Seats.t() | nil,
          :skuId => String.t() | nil,
          :skuName => String.t() | nil,
          :status => String.t() | nil,
          :subscriptionId => String.t() | nil,
          :suspensionReasons => list(String.t()) | nil,
          :transferInfo => GoogleApi.Reseller.V1.Model.SubscriptionTransferInfo.t() | nil,
          :trialSettings => GoogleApi.Reseller.V1.Model.SubscriptionTrialSettings.t() | nil
        }

  field(:billingMethod)
  field(:creationTime)
  field(:customerDomain)
  field(:customerId)
  field(:dealCode)
  field(:kind)
  field(:plan, as: GoogleApi.Reseller.V1.Model.SubscriptionPlan)
  field(:purchaseOrderId)
  field(:renewalSettings, as: GoogleApi.Reseller.V1.Model.RenewalSettings)
  field(:resourceUiUrl)
  field(:seats, as: GoogleApi.Reseller.V1.Model.Seats)
  field(:skuId)
  field(:skuName)
  field(:status)
  field(:subscriptionId)
  field(:suspensionReasons, type: :list)
  field(:transferInfo, as: GoogleApi.Reseller.V1.Model.SubscriptionTransferInfo)
  field(:trialSettings, as: GoogleApi.Reseller.V1.Model.SubscriptionTrialSettings)
end

defimpl Poison.Decoder, for: GoogleApi.Reseller.V1.Model.Subscription do
  def decode(value, options) do
    GoogleApi.Reseller.V1.Model.Subscription.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Reseller.V1.Model.Subscription do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
